/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
"use strict";

var $protobuf = require("protobufjs/minimal.js");

// Common aliases
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;

// Exported root namespace
var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});

/**
 * ErrCode enum.
 * @exports ErrCode
 * @enum {number}
 * @property {number} Err_None=0 Err_None value
 * @property {number} Err_Other=100 Err_Other value
 * @property {number} Err_Unmarshal=101 Err_Unmarshal value
 * @property {number} Err_Marshal=102 Err_Marshal value
 * @property {number} Err_Timeout=103 Err_Timeout value
 * @property {number} Err_Redis=104 Err_Redis value
 * @property {number} Err_MySql=105 Err_MySql value
 * @property {number} Err_PrimaryKey=106 Err_PrimaryKey value
 * @property {number} Err_FindData=107 Err_FindData value
 * @property {number} Err_RedisLock=108 Err_RedisLock value
 * @property {number} Err_ReadData=109 Err_ReadData value
 * @property {number} Err_WriteData=110 Err_WriteData value
 * @property {number} Err_Connected=111 Err_Connected value
 * @property {number} Err_String=112 Err_String value
 * @property {number} Err_String1=115 Err_String1 value
 * @property {number} Err_Safed=100099 Err_Safed value
 * @property {number} Err_AccountRegister=1201 Err_AccountRegister value
 * @property {number} Err_AccountLogin=1202 Err_AccountLogin value
 */
$root.ErrCode = (function() {
    var valuesById = {}, values = Object.create(valuesById);
    values[valuesById[0] = "Err_None"] = 0;
    values[valuesById[100] = "Err_Other"] = 100;
    values[valuesById[101] = "Err_Unmarshal"] = 101;
    values[valuesById[102] = "Err_Marshal"] = 102;
    values[valuesById[103] = "Err_Timeout"] = 103;
    values[valuesById[104] = "Err_Redis"] = 104;
    values[valuesById[105] = "Err_MySql"] = 105;
    values[valuesById[106] = "Err_PrimaryKey"] = 106;
    values[valuesById[107] = "Err_FindData"] = 107;
    values[valuesById[108] = "Err_RedisLock"] = 108;
    values[valuesById[109] = "Err_ReadData"] = 109;
    values[valuesById[110] = "Err_WriteData"] = 110;
    values[valuesById[111] = "Err_Connected"] = 111;
    values[valuesById[112] = "Err_String"] = 112;
    values[valuesById[115] = "Err_String1"] = 115;
    values[valuesById[100099] = "Err_Safed"] = 100099;
    values[valuesById[1201] = "Err_AccountRegister"] = 1201;
    values[valuesById[1202] = "Err_AccountLogin"] = 1202;
    return values;
})();

/**
 * DeviceType enum.
 * @exports DeviceType
 * @enum {number}
 * @property {number} Unknown=0 Unknown value
 * @property {number} Ctrl=1 Ctrl value
 * @property {number} DisplayA=2 DisplayA value
 * @property {number} DisplayB=3 DisplayB value
 */
$root.DeviceType = (function() {
    var valuesById = {}, values = Object.create(valuesById);
    values[valuesById[0] = "Unknown"] = 0;
    values[valuesById[1] = "Ctrl"] = 1;
    values[valuesById[2] = "DisplayA"] = 2;
    values[valuesById[3] = "DisplayB"] = 3;
    return values;
})();

$root.BaseMessage = (function() {

    /**
     * Properties of a BaseMessage.
     * @exports IBaseMessage
     * @interface IBaseMessage
     * @property {string|null} [MsgName] BaseMessage MsgName
     * @property {Uint8Array|null} [MsgData] BaseMessage MsgData
     * @property {IError|null} [Err] BaseMessage Err
     */

    /**
     * Constructs a new BaseMessage.
     * @exports BaseMessage
     * @classdesc Represents a BaseMessage.
     * @implements IBaseMessage
     * @constructor
     * @param {IBaseMessage=} [properties] Properties to set
     */
    function BaseMessage(properties) {
        if (properties)
            for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
                if (properties[keys[i]] != null)
                    this[keys[i]] = properties[keys[i]];
    }

    /**
     * BaseMessage MsgName.
     * @member {string} MsgName
     * @memberof BaseMessage
     * @instance
     */
    BaseMessage.prototype.MsgName = "";

    /**
     * BaseMessage MsgData.
     * @member {Uint8Array} MsgData
     * @memberof BaseMessage
     * @instance
     */
    BaseMessage.prototype.MsgData = $util.newBuffer([]);

    /**
     * BaseMessage Err.
     * @member {IError|null|undefined} Err
     * @memberof BaseMessage
     * @instance
     */
    BaseMessage.prototype.Err = null;

    /**
     * Creates a new BaseMessage instance using the specified properties.
     * @function create
     * @memberof BaseMessage
     * @static
     * @param {IBaseMessage=} [properties] Properties to set
     * @returns {BaseMessage} BaseMessage instance
     */
    BaseMessage.create = function create(properties) {
        return new BaseMessage(properties);
    };

    /**
     * Encodes the specified BaseMessage message. Does not implicitly {@link BaseMessage.verify|verify} messages.
     * @function encode
     * @memberof BaseMessage
     * @static
     * @param {IBaseMessage} message BaseMessage message or plain object to encode
     * @param {$protobuf.Writer} [writer] Writer to encode to
     * @returns {$protobuf.Writer} Writer
     */
    BaseMessage.encode = function encode(message, writer) {
        if (!writer)
            writer = $Writer.create();
        if (message.MsgName != null && Object.hasOwnProperty.call(message, "MsgName"))
            writer.uint32(/* id 1, wireType 2 =*/10).string(message.MsgName);
        if (message.MsgData != null && Object.hasOwnProperty.call(message, "MsgData"))
            writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.MsgData);
        if (message.Err != null && Object.hasOwnProperty.call(message, "Err"))
            $root.Error.encode(message.Err, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
        return writer;
    };

    /**
     * Encodes the specified BaseMessage message, length delimited. Does not implicitly {@link BaseMessage.verify|verify} messages.
     * @function encodeDelimited
     * @memberof BaseMessage
     * @static
     * @param {IBaseMessage} message BaseMessage message or plain object to encode
     * @param {$protobuf.Writer} [writer] Writer to encode to
     * @returns {$protobuf.Writer} Writer
     */
    BaseMessage.encodeDelimited = function encodeDelimited(message, writer) {
        return this.encode(message, writer).ldelim();
    };

    /**
     * Decodes a BaseMessage message from the specified reader or buffer.
     * @function decode
     * @memberof BaseMessage
     * @static
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
     * @param {number} [length] Message length if known beforehand
     * @returns {BaseMessage} BaseMessage
     * @throws {Error} If the payload is not a reader or valid buffer
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
     */
    BaseMessage.decode = function decode(reader, length) {
        if (!(reader instanceof $Reader))
            reader = $Reader.create(reader);
        var end = length === undefined ? reader.len : reader.pos + length, message = new $root.BaseMessage();
        while (reader.pos < end) {
            var tag = reader.uint32();
            switch (tag >>> 3) {
            case 1: {
                    message.MsgName = reader.string();
                    break;
                }
            case 2: {
                    message.MsgData = reader.bytes();
                    break;
                }
            case 3: {
                    message.Err = $root.Error.decode(reader, reader.uint32());
                    break;
                }
            default:
                reader.skipType(tag & 7);
                break;
            }
        }
        return message;
    };

    /**
     * Decodes a BaseMessage message from the specified reader or buffer, length delimited.
     * @function decodeDelimited
     * @memberof BaseMessage
     * @static
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
     * @returns {BaseMessage} BaseMessage
     * @throws {Error} If the payload is not a reader or valid buffer
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
     */
    BaseMessage.decodeDelimited = function decodeDelimited(reader) {
        if (!(reader instanceof $Reader))
            reader = new $Reader(reader);
        return this.decode(reader, reader.uint32());
    };

    /**
     * Verifies a BaseMessage message.
     * @function verify
     * @memberof BaseMessage
     * @static
     * @param {Object.<string,*>} message Plain object to verify
     * @returns {string|null} `null` if valid, otherwise the reason why it is not
     */
    BaseMessage.verify = function verify(message) {
        if (typeof message !== "object" || message === null)
            return "object expected";
        if (message.MsgName != null && message.hasOwnProperty("MsgName"))
            if (!$util.isString(message.MsgName))
                return "MsgName: string expected";
        if (message.MsgData != null && message.hasOwnProperty("MsgData"))
            if (!(message.MsgData && typeof message.MsgData.length === "number" || $util.isString(message.MsgData)))
                return "MsgData: buffer expected";
        if (message.Err != null && message.hasOwnProperty("Err")) {
            var error = $root.Error.verify(message.Err);
            if (error)
                return "Err." + error;
        }
        return null;
    };

    /**
     * Creates a BaseMessage message from a plain object. Also converts values to their respective internal types.
     * @function fromObject
     * @memberof BaseMessage
     * @static
     * @param {Object.<string,*>} object Plain object
     * @returns {BaseMessage} BaseMessage
     */
    BaseMessage.fromObject = function fromObject(object) {
        if (object instanceof $root.BaseMessage)
            return object;
        var message = new $root.BaseMessage();
        if (object.MsgName != null)
            message.MsgName = String(object.MsgName);
        if (object.MsgData != null)
            if (typeof object.MsgData === "string")
                $util.base64.decode(object.MsgData, message.MsgData = $util.newBuffer($util.base64.length(object.MsgData)), 0);
            else if (object.MsgData.length >= 0)
                message.MsgData = object.MsgData;
        if (object.Err != null) {
            if (typeof object.Err !== "object")
                throw TypeError(".BaseMessage.Err: object expected");
            message.Err = $root.Error.fromObject(object.Err);
        }
        return message;
    };

    /**
     * Creates a plain object from a BaseMessage message. Also converts values to other types if specified.
     * @function toObject
     * @memberof BaseMessage
     * @static
     * @param {BaseMessage} message BaseMessage
     * @param {$protobuf.IConversionOptions} [options] Conversion options
     * @returns {Object.<string,*>} Plain object
     */
    BaseMessage.toObject = function toObject(message, options) {
        if (!options)
            options = {};
        var object = {};
        if (options.defaults) {
            object.MsgName = "";
            if (options.bytes === String)
                object.MsgData = "";
            else {
                object.MsgData = [];
                if (options.bytes !== Array)
                    object.MsgData = $util.newBuffer(object.MsgData);
            }
            object.Err = null;
        }
        if (message.MsgName != null && message.hasOwnProperty("MsgName"))
            object.MsgName = message.MsgName;
        if (message.MsgData != null && message.hasOwnProperty("MsgData"))
            object.MsgData = options.bytes === String ? $util.base64.encode(message.MsgData, 0, message.MsgData.length) : options.bytes === Array ? Array.prototype.slice.call(message.MsgData) : message.MsgData;
        if (message.Err != null && message.hasOwnProperty("Err"))
            object.Err = $root.Error.toObject(message.Err, options);
        return object;
    };

    /**
     * Converts this BaseMessage to JSON.
     * @function toJSON
     * @memberof BaseMessage
     * @instance
     * @returns {Object.<string,*>} JSON object
     */
    BaseMessage.prototype.toJSON = function toJSON() {
        return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
    };

    /**
     * Gets the default type url for BaseMessage
     * @function getTypeUrl
     * @memberof BaseMessage
     * @static
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
     * @returns {string} The default type url
     */
    BaseMessage.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
        if (typeUrlPrefix === undefined) {
            typeUrlPrefix = "type.googleapis.com";
        }
        return typeUrlPrefix + "/BaseMessage";
    };

    return BaseMessage;
})();

$root.Error = (function() {

    /**
     * Properties of an Error.
     * @exports IError
     * @interface IError
     * @property {ErrCode|null} [Code] Error Code
     * @property {string|null} [Result] Error Result
     * @property {string|null} [ErrString] Error ErrString
     */

    /**
     * Constructs a new Error.
     * @exports Error
     * @classdesc Represents an Error.
     * @implements IError
     * @constructor
     * @param {IError=} [properties] Properties to set
     */
    function Error(properties) {
        if (properties)
            for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
                if (properties[keys[i]] != null)
                    this[keys[i]] = properties[keys[i]];
    }

    /**
     * Error Code.
     * @member {ErrCode} Code
     * @memberof Error
     * @instance
     */
    Error.prototype.Code = 0;

    /**
     * Error Result.
     * @member {string} Result
     * @memberof Error
     * @instance
     */
    Error.prototype.Result = "";

    /**
     * Error ErrString.
     * @member {string} ErrString
     * @memberof Error
     * @instance
     */
    Error.prototype.ErrString = "";

    /**
     * Creates a new Error instance using the specified properties.
     * @function create
     * @memberof Error
     * @static
     * @param {IError=} [properties] Properties to set
     * @returns {Error} Error instance
     */
    Error.create = function create(properties) {
        return new Error(properties);
    };

    /**
     * Encodes the specified Error message. Does not implicitly {@link Error.verify|verify} messages.
     * @function encode
     * @memberof Error
     * @static
     * @param {IError} message Error message or plain object to encode
     * @param {$protobuf.Writer} [writer] Writer to encode to
     * @returns {$protobuf.Writer} Writer
     */
    Error.encode = function encode(message, writer) {
        if (!writer)
            writer = $Writer.create();
        if (message.Code != null && Object.hasOwnProperty.call(message, "Code"))
            writer.uint32(/* id 1, wireType 0 =*/8).int32(message.Code);
        if (message.Result != null && Object.hasOwnProperty.call(message, "Result"))
            writer.uint32(/* id 2, wireType 2 =*/18).string(message.Result);
        if (message.ErrString != null && Object.hasOwnProperty.call(message, "ErrString"))
            writer.uint32(/* id 3, wireType 2 =*/26).string(message.ErrString);
        return writer;
    };

    /**
     * Encodes the specified Error message, length delimited. Does not implicitly {@link Error.verify|verify} messages.
     * @function encodeDelimited
     * @memberof Error
     * @static
     * @param {IError} message Error message or plain object to encode
     * @param {$protobuf.Writer} [writer] Writer to encode to
     * @returns {$protobuf.Writer} Writer
     */
    Error.encodeDelimited = function encodeDelimited(message, writer) {
        return this.encode(message, writer).ldelim();
    };

    /**
     * Decodes an Error message from the specified reader or buffer.
     * @function decode
     * @memberof Error
     * @static
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
     * @param {number} [length] Message length if known beforehand
     * @returns {Error} Error
     * @throws {Error} If the payload is not a reader or valid buffer
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
     */
    Error.decode = function decode(reader, length) {
        if (!(reader instanceof $Reader))
            reader = $Reader.create(reader);
        var end = length === undefined ? reader.len : reader.pos + length, message = new $root.Error();
        while (reader.pos < end) {
            var tag = reader.uint32();
            switch (tag >>> 3) {
            case 1: {
                    message.Code = reader.int32();
                    break;
                }
            case 2: {
                    message.Result = reader.string();
                    break;
                }
            case 3: {
                    message.ErrString = reader.string();
                    break;
                }
            default:
                reader.skipType(tag & 7);
                break;
            }
        }
        return message;
    };

    /**
     * Decodes an Error message from the specified reader or buffer, length delimited.
     * @function decodeDelimited
     * @memberof Error
     * @static
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
     * @returns {Error} Error
     * @throws {Error} If the payload is not a reader or valid buffer
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
     */
    Error.decodeDelimited = function decodeDelimited(reader) {
        if (!(reader instanceof $Reader))
            reader = new $Reader(reader);
        return this.decode(reader, reader.uint32());
    };

    /**
     * Verifies an Error message.
     * @function verify
     * @memberof Error
     * @static
     * @param {Object.<string,*>} message Plain object to verify
     * @returns {string|null} `null` if valid, otherwise the reason why it is not
     */
    Error.verify = function verify(message) {
        if (typeof message !== "object" || message === null)
            return "object expected";
        if (message.Code != null && message.hasOwnProperty("Code"))
            switch (message.Code) {
            default:
                return "Code: enum value expected";
            case 0:
            case 100:
            case 101:
            case 102:
            case 103:
            case 104:
            case 105:
            case 106:
            case 107:
            case 108:
            case 109:
            case 110:
            case 111:
            case 112:
            case 115:
            case 100099:
            case 1201:
            case 1202:
                break;
            }
        if (message.Result != null && message.hasOwnProperty("Result"))
            if (!$util.isString(message.Result))
                return "Result: string expected";
        if (message.ErrString != null && message.hasOwnProperty("ErrString"))
            if (!$util.isString(message.ErrString))
                return "ErrString: string expected";
        return null;
    };

    /**
     * Creates an Error message from a plain object. Also converts values to their respective internal types.
     * @function fromObject
     * @memberof Error
     * @static
     * @param {Object.<string,*>} object Plain object
     * @returns {Error} Error
     */
    Error.fromObject = function fromObject(object) {
        if (object instanceof $root.Error)
            return object;
        var message = new $root.Error();
        switch (object.Code) {
        default:
            if (typeof object.Code === "number") {
                message.Code = object.Code;
                break;
            }
            break;
        case "Err_None":
        case 0:
            message.Code = 0;
            break;
        case "Err_Other":
        case 100:
            message.Code = 100;
            break;
        case "Err_Unmarshal":
        case 101:
            message.Code = 101;
            break;
        case "Err_Marshal":
        case 102:
            message.Code = 102;
            break;
        case "Err_Timeout":
        case 103:
            message.Code = 103;
            break;
        case "Err_Redis":
        case 104:
            message.Code = 104;
            break;
        case "Err_MySql":
        case 105:
            message.Code = 105;
            break;
        case "Err_PrimaryKey":
        case 106:
            message.Code = 106;
            break;
        case "Err_FindData":
        case 107:
            message.Code = 107;
            break;
        case "Err_RedisLock":
        case 108:
            message.Code = 108;
            break;
        case "Err_ReadData":
        case 109:
            message.Code = 109;
            break;
        case "Err_WriteData":
        case 110:
            message.Code = 110;
            break;
        case "Err_Connected":
        case 111:
            message.Code = 111;
            break;
        case "Err_String":
        case 112:
            message.Code = 112;
            break;
        case "Err_String1":
        case 115:
            message.Code = 115;
            break;
        case "Err_Safed":
        case 100099:
            message.Code = 100099;
            break;
        case "Err_AccountRegister":
        case 1201:
            message.Code = 1201;
            break;
        case "Err_AccountLogin":
        case 1202:
            message.Code = 1202;
            break;
        }
        if (object.Result != null)
            message.Result = String(object.Result);
        if (object.ErrString != null)
            message.ErrString = String(object.ErrString);
        return message;
    };

    /**
     * Creates a plain object from an Error message. Also converts values to other types if specified.
     * @function toObject
     * @memberof Error
     * @static
     * @param {Error} message Error
     * @param {$protobuf.IConversionOptions} [options] Conversion options
     * @returns {Object.<string,*>} Plain object
     */
    Error.toObject = function toObject(message, options) {
        if (!options)
            options = {};
        var object = {};
        if (options.defaults) {
            object.Code = options.enums === String ? "Err_None" : 0;
            object.Result = "";
            object.ErrString = "";
        }
        if (message.Code != null && message.hasOwnProperty("Code"))
            object.Code = options.enums === String ? $root.ErrCode[message.Code] === undefined ? message.Code : $root.ErrCode[message.Code] : message.Code;
        if (message.Result != null && message.hasOwnProperty("Result"))
            object.Result = message.Result;
        if (message.ErrString != null && message.hasOwnProperty("ErrString"))
            object.ErrString = message.ErrString;
        return object;
    };

    /**
     * Converts this Error to JSON.
     * @function toJSON
     * @memberof Error
     * @instance
     * @returns {Object.<string,*>} JSON object
     */
    Error.prototype.toJSON = function toJSON() {
        return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
    };

    /**
     * Gets the default type url for Error
     * @function getTypeUrl
     * @memberof Error
     * @static
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
     * @returns {string} The default type url
     */
    Error.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
        if (typeUrlPrefix === undefined) {
            typeUrlPrefix = "type.googleapis.com";
        }
        return typeUrlPrefix + "/Error";
    };

    return Error;
})();

$root.RegisterDeviceR = (function() {

    /**
     * Properties of a RegisterDeviceR.
     * @exports IRegisterDeviceR
     * @interface IRegisterDeviceR
     * @property {DeviceType|null} [type] RegisterDeviceR type
     */

    /**
     * Constructs a new RegisterDeviceR.
     * @exports RegisterDeviceR
     * @classdesc Represents a RegisterDeviceR.
     * @implements IRegisterDeviceR
     * @constructor
     * @param {IRegisterDeviceR=} [properties] Properties to set
     */
    function RegisterDeviceR(properties) {
        if (properties)
            for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
                if (properties[keys[i]] != null)
                    this[keys[i]] = properties[keys[i]];
    }

    /**
     * RegisterDeviceR type.
     * @member {DeviceType} type
     * @memberof RegisterDeviceR
     * @instance
     */
    RegisterDeviceR.prototype.type = 0;

    /**
     * Creates a new RegisterDeviceR instance using the specified properties.
     * @function create
     * @memberof RegisterDeviceR
     * @static
     * @param {IRegisterDeviceR=} [properties] Properties to set
     * @returns {RegisterDeviceR} RegisterDeviceR instance
     */
    RegisterDeviceR.create = function create(properties) {
        return new RegisterDeviceR(properties);
    };

    /**
     * Encodes the specified RegisterDeviceR message. Does not implicitly {@link RegisterDeviceR.verify|verify} messages.
     * @function encode
     * @memberof RegisterDeviceR
     * @static
     * @param {IRegisterDeviceR} message RegisterDeviceR message or plain object to encode
     * @param {$protobuf.Writer} [writer] Writer to encode to
     * @returns {$protobuf.Writer} Writer
     */
    RegisterDeviceR.encode = function encode(message, writer) {
        if (!writer)
            writer = $Writer.create();
        if (message.type != null && Object.hasOwnProperty.call(message, "type"))
            writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type);
        return writer;
    };

    /**
     * Encodes the specified RegisterDeviceR message, length delimited. Does not implicitly {@link RegisterDeviceR.verify|verify} messages.
     * @function encodeDelimited
     * @memberof RegisterDeviceR
     * @static
     * @param {IRegisterDeviceR} message RegisterDeviceR message or plain object to encode
     * @param {$protobuf.Writer} [writer] Writer to encode to
     * @returns {$protobuf.Writer} Writer
     */
    RegisterDeviceR.encodeDelimited = function encodeDelimited(message, writer) {
        return this.encode(message, writer).ldelim();
    };

    /**
     * Decodes a RegisterDeviceR message from the specified reader or buffer.
     * @function decode
     * @memberof RegisterDeviceR
     * @static
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
     * @param {number} [length] Message length if known beforehand
     * @returns {RegisterDeviceR} RegisterDeviceR
     * @throws {Error} If the payload is not a reader or valid buffer
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
     */
    RegisterDeviceR.decode = function decode(reader, length) {
        if (!(reader instanceof $Reader))
            reader = $Reader.create(reader);
        var end = length === undefined ? reader.len : reader.pos + length, message = new $root.RegisterDeviceR();
        while (reader.pos < end) {
            var tag = reader.uint32();
            switch (tag >>> 3) {
            case 1: {
                    message.type = reader.int32();
                    break;
                }
            default:
                reader.skipType(tag & 7);
                break;
            }
        }
        return message;
    };

    /**
     * Decodes a RegisterDeviceR message from the specified reader or buffer, length delimited.
     * @function decodeDelimited
     * @memberof RegisterDeviceR
     * @static
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
     * @returns {RegisterDeviceR} RegisterDeviceR
     * @throws {Error} If the payload is not a reader or valid buffer
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
     */
    RegisterDeviceR.decodeDelimited = function decodeDelimited(reader) {
        if (!(reader instanceof $Reader))
            reader = new $Reader(reader);
        return this.decode(reader, reader.uint32());
    };

    /**
     * Verifies a RegisterDeviceR message.
     * @function verify
     * @memberof RegisterDeviceR
     * @static
     * @param {Object.<string,*>} message Plain object to verify
     * @returns {string|null} `null` if valid, otherwise the reason why it is not
     */
    RegisterDeviceR.verify = function verify(message) {
        if (typeof message !== "object" || message === null)
            return "object expected";
        if (message.type != null && message.hasOwnProperty("type"))
            switch (message.type) {
            default:
                return "type: enum value expected";
            case 0:
            case 1:
            case 2:
            case 3:
                break;
            }
        return null;
    };

    /**
     * Creates a RegisterDeviceR message from a plain object. Also converts values to their respective internal types.
     * @function fromObject
     * @memberof RegisterDeviceR
     * @static
     * @param {Object.<string,*>} object Plain object
     * @returns {RegisterDeviceR} RegisterDeviceR
     */
    RegisterDeviceR.fromObject = function fromObject(object) {
        if (object instanceof $root.RegisterDeviceR)
            return object;
        var message = new $root.RegisterDeviceR();
        switch (object.type) {
        default:
            if (typeof object.type === "number") {
                message.type = object.type;
                break;
            }
            break;
        case "Unknown":
        case 0:
            message.type = 0;
            break;
        case "Ctrl":
        case 1:
            message.type = 1;
            break;
        case "DisplayA":
        case 2:
            message.type = 2;
            break;
        case "DisplayB":
        case 3:
            message.type = 3;
            break;
        }
        return message;
    };

    /**
     * Creates a plain object from a RegisterDeviceR message. Also converts values to other types if specified.
     * @function toObject
     * @memberof RegisterDeviceR
     * @static
     * @param {RegisterDeviceR} message RegisterDeviceR
     * @param {$protobuf.IConversionOptions} [options] Conversion options
     * @returns {Object.<string,*>} Plain object
     */
    RegisterDeviceR.toObject = function toObject(message, options) {
        if (!options)
            options = {};
        var object = {};
        if (options.defaults)
            object.type = options.enums === String ? "Unknown" : 0;
        if (message.type != null && message.hasOwnProperty("type"))
            object.type = options.enums === String ? $root.DeviceType[message.type] === undefined ? message.type : $root.DeviceType[message.type] : message.type;
        return object;
    };

    /**
     * Converts this RegisterDeviceR to JSON.
     * @function toJSON
     * @memberof RegisterDeviceR
     * @instance
     * @returns {Object.<string,*>} JSON object
     */
    RegisterDeviceR.prototype.toJSON = function toJSON() {
        return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
    };

    /**
     * Gets the default type url for RegisterDeviceR
     * @function getTypeUrl
     * @memberof RegisterDeviceR
     * @static
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
     * @returns {string} The default type url
     */
    RegisterDeviceR.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
        if (typeUrlPrefix === undefined) {
            typeUrlPrefix = "type.googleapis.com";
        }
        return typeUrlPrefix + "/RegisterDeviceR";
    };

    return RegisterDeviceR;
})();

$root.RegisterDeviceA = (function() {

    /**
     * Properties of a RegisterDeviceA.
     * @exports IRegisterDeviceA
     * @interface IRegisterDeviceA
     * @property {ErrCode|null} [Code] RegisterDeviceA Code
     */

    /**
     * Constructs a new RegisterDeviceA.
     * @exports RegisterDeviceA
     * @classdesc Represents a RegisterDeviceA.
     * @implements IRegisterDeviceA
     * @constructor
     * @param {IRegisterDeviceA=} [properties] Properties to set
     */
    function RegisterDeviceA(properties) {
        if (properties)
            for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
                if (properties[keys[i]] != null)
                    this[keys[i]] = properties[keys[i]];
    }

    /**
     * RegisterDeviceA Code.
     * @member {ErrCode} Code
     * @memberof RegisterDeviceA
     * @instance
     */
    RegisterDeviceA.prototype.Code = 0;

    /**
     * Creates a new RegisterDeviceA instance using the specified properties.
     * @function create
     * @memberof RegisterDeviceA
     * @static
     * @param {IRegisterDeviceA=} [properties] Properties to set
     * @returns {RegisterDeviceA} RegisterDeviceA instance
     */
    RegisterDeviceA.create = function create(properties) {
        return new RegisterDeviceA(properties);
    };

    /**
     * Encodes the specified RegisterDeviceA message. Does not implicitly {@link RegisterDeviceA.verify|verify} messages.
     * @function encode
     * @memberof RegisterDeviceA
     * @static
     * @param {IRegisterDeviceA} message RegisterDeviceA message or plain object to encode
     * @param {$protobuf.Writer} [writer] Writer to encode to
     * @returns {$protobuf.Writer} Writer
     */
    RegisterDeviceA.encode = function encode(message, writer) {
        if (!writer)
            writer = $Writer.create();
        if (message.Code != null && Object.hasOwnProperty.call(message, "Code"))
            writer.uint32(/* id 1, wireType 0 =*/8).int32(message.Code);
        return writer;
    };

    /**
     * Encodes the specified RegisterDeviceA message, length delimited. Does not implicitly {@link RegisterDeviceA.verify|verify} messages.
     * @function encodeDelimited
     * @memberof RegisterDeviceA
     * @static
     * @param {IRegisterDeviceA} message RegisterDeviceA message or plain object to encode
     * @param {$protobuf.Writer} [writer] Writer to encode to
     * @returns {$protobuf.Writer} Writer
     */
    RegisterDeviceA.encodeDelimited = function encodeDelimited(message, writer) {
        return this.encode(message, writer).ldelim();
    };

    /**
     * Decodes a RegisterDeviceA message from the specified reader or buffer.
     * @function decode
     * @memberof RegisterDeviceA
     * @static
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
     * @param {number} [length] Message length if known beforehand
     * @returns {RegisterDeviceA} RegisterDeviceA
     * @throws {Error} If the payload is not a reader or valid buffer
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
     */
    RegisterDeviceA.decode = function decode(reader, length) {
        if (!(reader instanceof $Reader))
            reader = $Reader.create(reader);
        var end = length === undefined ? reader.len : reader.pos + length, message = new $root.RegisterDeviceA();
        while (reader.pos < end) {
            var tag = reader.uint32();
            switch (tag >>> 3) {
            case 1: {
                    message.Code = reader.int32();
                    break;
                }
            default:
                reader.skipType(tag & 7);
                break;
            }
        }
        return message;
    };

    /**
     * Decodes a RegisterDeviceA message from the specified reader or buffer, length delimited.
     * @function decodeDelimited
     * @memberof RegisterDeviceA
     * @static
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
     * @returns {RegisterDeviceA} RegisterDeviceA
     * @throws {Error} If the payload is not a reader or valid buffer
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
     */
    RegisterDeviceA.decodeDelimited = function decodeDelimited(reader) {
        if (!(reader instanceof $Reader))
            reader = new $Reader(reader);
        return this.decode(reader, reader.uint32());
    };

    /**
     * Verifies a RegisterDeviceA message.
     * @function verify
     * @memberof RegisterDeviceA
     * @static
     * @param {Object.<string,*>} message Plain object to verify
     * @returns {string|null} `null` if valid, otherwise the reason why it is not
     */
    RegisterDeviceA.verify = function verify(message) {
        if (typeof message !== "object" || message === null)
            return "object expected";
        if (message.Code != null && message.hasOwnProperty("Code"))
            switch (message.Code) {
            default:
                return "Code: enum value expected";
            case 0:
            case 100:
            case 101:
            case 102:
            case 103:
            case 104:
            case 105:
            case 106:
            case 107:
            case 108:
            case 109:
            case 110:
            case 111:
            case 112:
            case 115:
            case 100099:
            case 1201:
            case 1202:
                break;
            }
        return null;
    };

    /**
     * Creates a RegisterDeviceA message from a plain object. Also converts values to their respective internal types.
     * @function fromObject
     * @memberof RegisterDeviceA
     * @static
     * @param {Object.<string,*>} object Plain object
     * @returns {RegisterDeviceA} RegisterDeviceA
     */
    RegisterDeviceA.fromObject = function fromObject(object) {
        if (object instanceof $root.RegisterDeviceA)
            return object;
        var message = new $root.RegisterDeviceA();
        switch (object.Code) {
        default:
            if (typeof object.Code === "number") {
                message.Code = object.Code;
                break;
            }
            break;
        case "Err_None":
        case 0:
            message.Code = 0;
            break;
        case "Err_Other":
        case 100:
            message.Code = 100;
            break;
        case "Err_Unmarshal":
        case 101:
            message.Code = 101;
            break;
        case "Err_Marshal":
        case 102:
            message.Code = 102;
            break;
        case "Err_Timeout":
        case 103:
            message.Code = 103;
            break;
        case "Err_Redis":
        case 104:
            message.Code = 104;
            break;
        case "Err_MySql":
        case 105:
            message.Code = 105;
            break;
        case "Err_PrimaryKey":
        case 106:
            message.Code = 106;
            break;
        case "Err_FindData":
        case 107:
            message.Code = 107;
            break;
        case "Err_RedisLock":
        case 108:
            message.Code = 108;
            break;
        case "Err_ReadData":
        case 109:
            message.Code = 109;
            break;
        case "Err_WriteData":
        case 110:
            message.Code = 110;
            break;
        case "Err_Connected":
        case 111:
            message.Code = 111;
            break;
        case "Err_String":
        case 112:
            message.Code = 112;
            break;
        case "Err_String1":
        case 115:
            message.Code = 115;
            break;
        case "Err_Safed":
        case 100099:
            message.Code = 100099;
            break;
        case "Err_AccountRegister":
        case 1201:
            message.Code = 1201;
            break;
        case "Err_AccountLogin":
        case 1202:
            message.Code = 1202;
            break;
        }
        return message;
    };

    /**
     * Creates a plain object from a RegisterDeviceA message. Also converts values to other types if specified.
     * @function toObject
     * @memberof RegisterDeviceA
     * @static
     * @param {RegisterDeviceA} message RegisterDeviceA
     * @param {$protobuf.IConversionOptions} [options] Conversion options
     * @returns {Object.<string,*>} Plain object
     */
    RegisterDeviceA.toObject = function toObject(message, options) {
        if (!options)
            options = {};
        var object = {};
        if (options.defaults)
            object.Code = options.enums === String ? "Err_None" : 0;
        if (message.Code != null && message.hasOwnProperty("Code"))
            object.Code = options.enums === String ? $root.ErrCode[message.Code] === undefined ? message.Code : $root.ErrCode[message.Code] : message.Code;
        return object;
    };

    /**
     * Converts this RegisterDeviceA to JSON.
     * @function toJSON
     * @memberof RegisterDeviceA
     * @instance
     * @returns {Object.<string,*>} JSON object
     */
    RegisterDeviceA.prototype.toJSON = function toJSON() {
        return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
    };

    /**
     * Gets the default type url for RegisterDeviceA
     * @function getTypeUrl
     * @memberof RegisterDeviceA
     * @static
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
     * @returns {string} The default type url
     */
    RegisterDeviceA.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
        if (typeUrlPrefix === undefined) {
            typeUrlPrefix = "type.googleapis.com";
        }
        return typeUrlPrefix + "/RegisterDeviceA";
    };

    return RegisterDeviceA;
})();

$root.Ping = (function() {

    /**
     * Properties of a Ping.
     * @exports IPing
     * @interface IPing
     */

    /**
     * Constructs a new Ping.
     * @exports Ping
     * @classdesc Represents a Ping.
     * @implements IPing
     * @constructor
     * @param {IPing=} [properties] Properties to set
     */
    function Ping(properties) {
        if (properties)
            for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
                if (properties[keys[i]] != null)
                    this[keys[i]] = properties[keys[i]];
    }

    /**
     * Creates a new Ping instance using the specified properties.
     * @function create
     * @memberof Ping
     * @static
     * @param {IPing=} [properties] Properties to set
     * @returns {Ping} Ping instance
     */
    Ping.create = function create(properties) {
        return new Ping(properties);
    };

    /**
     * Encodes the specified Ping message. Does not implicitly {@link Ping.verify|verify} messages.
     * @function encode
     * @memberof Ping
     * @static
     * @param {IPing} message Ping message or plain object to encode
     * @param {$protobuf.Writer} [writer] Writer to encode to
     * @returns {$protobuf.Writer} Writer
     */
    Ping.encode = function encode(message, writer) {
        if (!writer)
            writer = $Writer.create();
        return writer;
    };

    /**
     * Encodes the specified Ping message, length delimited. Does not implicitly {@link Ping.verify|verify} messages.
     * @function encodeDelimited
     * @memberof Ping
     * @static
     * @param {IPing} message Ping message or plain object to encode
     * @param {$protobuf.Writer} [writer] Writer to encode to
     * @returns {$protobuf.Writer} Writer
     */
    Ping.encodeDelimited = function encodeDelimited(message, writer) {
        return this.encode(message, writer).ldelim();
    };

    /**
     * Decodes a Ping message from the specified reader or buffer.
     * @function decode
     * @memberof Ping
     * @static
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
     * @param {number} [length] Message length if known beforehand
     * @returns {Ping} Ping
     * @throws {Error} If the payload is not a reader or valid buffer
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
     */
    Ping.decode = function decode(reader, length) {
        if (!(reader instanceof $Reader))
            reader = $Reader.create(reader);
        var end = length === undefined ? reader.len : reader.pos + length, message = new $root.Ping();
        while (reader.pos < end) {
            var tag = reader.uint32();
            switch (tag >>> 3) {
            default:
                reader.skipType(tag & 7);
                break;
            }
        }
        return message;
    };

    /**
     * Decodes a Ping message from the specified reader or buffer, length delimited.
     * @function decodeDelimited
     * @memberof Ping
     * @static
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
     * @returns {Ping} Ping
     * @throws {Error} If the payload is not a reader or valid buffer
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
     */
    Ping.decodeDelimited = function decodeDelimited(reader) {
        if (!(reader instanceof $Reader))
            reader = new $Reader(reader);
        return this.decode(reader, reader.uint32());
    };

    /**
     * Verifies a Ping message.
     * @function verify
     * @memberof Ping
     * @static
     * @param {Object.<string,*>} message Plain object to verify
     * @returns {string|null} `null` if valid, otherwise the reason why it is not
     */
    Ping.verify = function verify(message) {
        if (typeof message !== "object" || message === null)
            return "object expected";
        return null;
    };

    /**
     * Creates a Ping message from a plain object. Also converts values to their respective internal types.
     * @function fromObject
     * @memberof Ping
     * @static
     * @param {Object.<string,*>} object Plain object
     * @returns {Ping} Ping
     */
    Ping.fromObject = function fromObject(object) {
        if (object instanceof $root.Ping)
            return object;
        return new $root.Ping();
    };

    /**
     * Creates a plain object from a Ping message. Also converts values to other types if specified.
     * @function toObject
     * @memberof Ping
     * @static
     * @param {Ping} message Ping
     * @param {$protobuf.IConversionOptions} [options] Conversion options
     * @returns {Object.<string,*>} Plain object
     */
    Ping.toObject = function toObject() {
        return {};
    };

    /**
     * Converts this Ping to JSON.
     * @function toJSON
     * @memberof Ping
     * @instance
     * @returns {Object.<string,*>} JSON object
     */
    Ping.prototype.toJSON = function toJSON() {
        return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
    };

    /**
     * Gets the default type url for Ping
     * @function getTypeUrl
     * @memberof Ping
     * @static
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
     * @returns {string} The default type url
     */
    Ping.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
        if (typeUrlPrefix === undefined) {
            typeUrlPrefix = "type.googleapis.com";
        }
        return typeUrlPrefix + "/Ping";
    };

    return Ping;
})();

$root.Pong = (function() {

    /**
     * Properties of a Pong.
     * @exports IPong
     * @interface IPong
     */

    /**
     * Constructs a new Pong.
     * @exports Pong
     * @classdesc Represents a Pong.
     * @implements IPong
     * @constructor
     * @param {IPong=} [properties] Properties to set
     */
    function Pong(properties) {
        if (properties)
            for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
                if (properties[keys[i]] != null)
                    this[keys[i]] = properties[keys[i]];
    }

    /**
     * Creates a new Pong instance using the specified properties.
     * @function create
     * @memberof Pong
     * @static
     * @param {IPong=} [properties] Properties to set
     * @returns {Pong} Pong instance
     */
    Pong.create = function create(properties) {
        return new Pong(properties);
    };

    /**
     * Encodes the specified Pong message. Does not implicitly {@link Pong.verify|verify} messages.
     * @function encode
     * @memberof Pong
     * @static
     * @param {IPong} message Pong message or plain object to encode
     * @param {$protobuf.Writer} [writer] Writer to encode to
     * @returns {$protobuf.Writer} Writer
     */
    Pong.encode = function encode(message, writer) {
        if (!writer)
            writer = $Writer.create();
        return writer;
    };

    /**
     * Encodes the specified Pong message, length delimited. Does not implicitly {@link Pong.verify|verify} messages.
     * @function encodeDelimited
     * @memberof Pong
     * @static
     * @param {IPong} message Pong message or plain object to encode
     * @param {$protobuf.Writer} [writer] Writer to encode to
     * @returns {$protobuf.Writer} Writer
     */
    Pong.encodeDelimited = function encodeDelimited(message, writer) {
        return this.encode(message, writer).ldelim();
    };

    /**
     * Decodes a Pong message from the specified reader or buffer.
     * @function decode
     * @memberof Pong
     * @static
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
     * @param {number} [length] Message length if known beforehand
     * @returns {Pong} Pong
     * @throws {Error} If the payload is not a reader or valid buffer
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
     */
    Pong.decode = function decode(reader, length) {
        if (!(reader instanceof $Reader))
            reader = $Reader.create(reader);
        var end = length === undefined ? reader.len : reader.pos + length, message = new $root.Pong();
        while (reader.pos < end) {
            var tag = reader.uint32();
            switch (tag >>> 3) {
            default:
                reader.skipType(tag & 7);
                break;
            }
        }
        return message;
    };

    /**
     * Decodes a Pong message from the specified reader or buffer, length delimited.
     * @function decodeDelimited
     * @memberof Pong
     * @static
     * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
     * @returns {Pong} Pong
     * @throws {Error} If the payload is not a reader or valid buffer
     * @throws {$protobuf.util.ProtocolError} If required fields are missing
     */
    Pong.decodeDelimited = function decodeDelimited(reader) {
        if (!(reader instanceof $Reader))
            reader = new $Reader(reader);
        return this.decode(reader, reader.uint32());
    };

    /**
     * Verifies a Pong message.
     * @function verify
     * @memberof Pong
     * @static
     * @param {Object.<string,*>} message Plain object to verify
     * @returns {string|null} `null` if valid, otherwise the reason why it is not
     */
    Pong.verify = function verify(message) {
        if (typeof message !== "object" || message === null)
            return "object expected";
        return null;
    };

    /**
     * Creates a Pong message from a plain object. Also converts values to their respective internal types.
     * @function fromObject
     * @memberof Pong
     * @static
     * @param {Object.<string,*>} object Plain object
     * @returns {Pong} Pong
     */
    Pong.fromObject = function fromObject(object) {
        if (object instanceof $root.Pong)
            return object;
        return new $root.Pong();
    };

    /**
     * Creates a plain object from a Pong message. Also converts values to other types if specified.
     * @function toObject
     * @memberof Pong
     * @static
     * @param {Pong} message Pong
     * @param {$protobuf.IConversionOptions} [options] Conversion options
     * @returns {Object.<string,*>} Plain object
     */
    Pong.toObject = function toObject() {
        return {};
    };

    /**
     * Converts this Pong to JSON.
     * @function toJSON
     * @memberof Pong
     * @instance
     * @returns {Object.<string,*>} JSON object
     */
    Pong.prototype.toJSON = function toJSON() {
        return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
    };

    /**
     * Gets the default type url for Pong
     * @function getTypeUrl
     * @memberof Pong
     * @static
     * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
     * @returns {string} The default type url
     */
    Pong.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
        if (typeUrlPrefix === undefined) {
            typeUrlPrefix = "type.googleapis.com";
        }
        return typeUrlPrefix + "/Pong";
    };

    return Pong;
})();

module.exports = $root;
